# Maintainer: psykose <alice@ayaya.dev>
pkgname=ctypes-sh
# additional support for musl was merged after the last tag
pkgver=1.2_git20201103
_gitrev=6982e6cb226502cb89173fb272b3ef0438e593c4
pkgrel=0
pkgdesc="FFI for bash"
url="https://github.com/taviso/ctypes.sh"
# ftbfs arm: (__ILP32__ undefined?)
# ppc64le: messed up includes
arch="all !armhf !armv7 !ppc64le"
license="MIT"
depends="bash"
makedepends="
	autoconf
	automake
	elfutils-dev
	libdwarf-dev
	libffi-dev
	libtool
	"
source="https://github.com/taviso/ctypes.sh/archive/$_gitrev/ctypes-sh-$_gitrev.tar.gz"
builddir="$srcdir/ctypes.sh-$_gitrev"
options="!check" # tests need install

prepare() {
	default_prepare

	NOCONFIGURE=1 ./autogen.sh
}

build() {
	./configure \
		--host=$CHOST \
		--build=$CBUILD \
		--target=$CTARGET \
		--prefix=/usr
	make
}

check() {
	make -C test
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
a06ee9cf030267bfda6bd31281c05bbd6886919df28875947660d1fba81a3c2565a82884c0318600be0bdb6970f46aa39d47c59ce9ebd3c767e56b7c0cb0cb8c  ctypes-sh-6982e6cb226502cb89173fb272b3ef0438e593c4.tar.gz
"
